﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Hyt.Core.Authentication;
using Hyt.Core.Security;

namespace Huayuan.Manage.Common
{
    public class ManageAuthRule : IAuthRule
    {
        public RuleMatchResult Match(Hyt.Core.Security.IPrincipal principal, string operation)
        {
            if (operation == "Login.Auth")
            {
                //return new RuleMatchResult { Message = "请先登陆", Status = RuleMatchState.Refusal };
            }
            if (principal == Principal.Anonymous)
            {
                //return new RuleMatchResult { Message = "匿名用户禁止操作", Status = RuleMatchState.Refusal };
            }
            if (principal.GetPrincipalType() == "member")
            {
                // return new RuleMatchResult { Message = "管理员操作，用户禁止操作", Status = RuleMatchState.Refusal };
            }
            return new RuleMatchResult { Status = RuleMatchState.Allow };
        }
    }
}